#include "Window.h"

Window::Window(WINDOW* win) {
	m_window = win;
}

Window::Window(int width, int height, int x, int y, bool hasBorder) 
 : m_width(width), m_height(height), m_x(x), m_y(y), m_hasBorder(hasBorder)
{
	m_window = newwin(height, width, y, x);
}

Window::~Window() {
	delwin(m_window);
}

void Window::reposition(int x, int y) {
	m_x = x;
	m_y = y;
	mvwin(m_window, y, x);
}

void Window::refresh() {
	if (m_hasBorder) {
		box(m_window, 0, 0);
	}
	wrefresh(m_window);
}

void Window::clear() {
	wclear(m_window);
}

void Window::enableAttributes(int flags) {
	wattron(m_window, flags);
}

void Window::disableAttributes(int flags) {
	wattroff(m_window, flags);
}